#include<iostream>
#include<deque>
using namespace std;
int a[2000010];
int sum[2000010];
int main()
{
	deque<int> q;
	int  n = 0;
	cin >> n;
	for (int i = 1;i <= n;i++)
	{
		cin >> a[i];
		a[i + n] = a[i];
	}
	for (int i = 1;i <= 2 * n - 1;i++)
	{
		sum[i] = sum[i - 1] + a[i];
	}
	int ret = 0;
	for (int i = 1;i <= 2 * n - 1;i++)
	{
		while (!q.empty() && sum[q.back()] > sum[i])q.pop_back();
		q.push_back(i);
		if (i >= n)
		{
			while (!q.empty() && q.front() <= i - n)q.pop_front();
			if ((sum[q.front()]-sum[i-n]) >= 0)ret++;
		}
	}
	cout << ret << endl;

	return 0;
}